var Main = function() {
	mui.init({
		swipeBack: false //启用右滑关闭功能
	});
	this.init();
	this.even();
	this.loadData();
};
Main.prototype = {
	init: function() {
		Util.checkLoginRedirect();
	},
	even: function() {
		
		$("#recharge").on('tap', function() {
			var amount = $("#rechargeAmount").val();
			if(!Verify.isMoney(amount)) {
				mui.toast(Verify.isMoneyMsg);
				return false;
			}
			if(parseFloat(amount) < 100) {
				Util.toast("充值金额必须大于100");
				return false
			};
			mui(this).button('loading');
			setTimeout(function() {
				mui(this).button('reset');
			}.bind(this), 5000);
			var url = server_url + "/pay/rechargePay.do";
			var param = {
				"isMobile": isMobile,
				"amount": amount,
				"pageType":1,
				"accountid": storage.memberId
			}
			url = UrlHelper.customUrl(UrlHelper.urlEncode(param), url);
			//判定app
			if(isH5){
				window.open(url, '_system', 'location=yes');
			}else{
				url = encodeURIComponent(url);
				mui.openWindow({"url":"huifu.html?url=" + url + "&module=recharge","id":"huifu-page"});
			}

		});
	},
	loadData: function() {
		var options = {  
			useEasing: true,
			  useGrouping: true,
			  separator: '',
			  decimal: '.',
			  prefix: '账户余额：',
			  suffix: '元',
			separator: ','
		};
		var totalEarnings = new CountUp("balance", 0.00, Util.requestURL('balance'), 2, 1, options);
		totalEarnings.start();
	}
}